from HTMLTestRunner_cn import HTMLTestRunner
import unittest
import os
import time
BASE_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
REPORTS_PATH = os.path.join(BASE_PATH, r'H:\tool2\pycharm\PyCharm 2020.1\hd54_group1_poject3\reports')

test_dir = "./cases/test_chances_cases"
discover = unittest.defaultTestLoader.discover(test_dir, pattern="case*.py")

now = time.strftime("%Y%m%d%H%M%S")
report_name = os.path.join(REPORTS_PATH, "test-crm-{}.html".format(now))

f = open(report_name, "wb")
runner = HTMLTestRunner(stream=f, title="墨白-销售机会模块", description="用例执行情况")
runner.run(discover)
f.close()